package com.zzy.pool;

import java.net.Socket;

import org.apache.commons.pool.impl.GenericObjectPool.Config;


public class TestMain {  
  
    /** 
     * @param args 
     */  
    public static void main(String[] args) {  
        Config config = new Config();  
        config.maxActive = 16;  
        config.maxWait = 30000;  
        ConnectionPoolFactory poolFactory = new ConnectionPoolFactory(config, "127.0.0.1", 80);  
        Socket socket = null ;  
        try{  
            socket = poolFactory.getConnection(); 
            System.out.println("连上:"+socket.getPort());
            ////  
        }catch(Exception e){  
            e.printStackTrace();  
        }finally{  
            if(socket != null){  
                poolFactory.releaseConnection(socket);  
            }  
        }  
  
    }  
  
}  